/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercicio.lista3;

import java.util.Random;

/**
 *
 * @author afonso
 */
public class Questao4 {

    public static void main(String[] args) {
        int numExp = 10000;
        double soma = 0;
        Random r = new Random();

        for (int i = 0; i < numExp; i++) {
            double tMenor = Double.MAX_VALUE;
            for (int circ = 0; circ < 3; circ++) {
                double tempo = -1000 * Math.log(r.nextDouble());
                if (tempo < tMenor) {
                    tMenor = tempo;
                }
            }
            soma += tMenor;
        }
        double media = soma / numExp;

        System.out.println("Tempo médio: " + media + "h");
    }
}
